﻿Imports PackageIO
Public Class Form2

    Dim FilePath As String

    Private Sub ButtonX1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonX1.Click
        Try
            Dim open As New OpenFileDialog
            open.Title = "Open as Xbox 360 GameSave"
            open.ShowDialog()
            FilePath = open.FileName
            ReadFile()
        Catch ex As Exception
        End Try

    End Sub

    Private Sub ButtonX2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonX2.Click
        Dim writer As New PackageIO.Writer(FilePath, PackageIO.Endian.Big)
        writer.Position = &HD04B
        writer.WriteInt32(TextBox1.Text)
        Dim writer2 As New PackageIO.Writer(FilePath, PackageIO.Endian.Big)
        writer2.Position = &HD03F
        writer2.WriteInt32(TextBox3.Text)
        Dim writer3 As New PackageIO.Writer(FilePath, PackageIO.Endian.Big)
        writer3.Position = &HD03B
        writer3.WriteInt32(TextBox5.Text)
        MsgBox("GameSave modded!", MsgBoxStyle.Information)
    End Sub
    Private Sub ReadFile()
        Dim Reader As New PackageIO.Reader(FilePath, PackageIO.Endian.Big)
        Dim Reader2 As New PackageIO.Reader(FilePath, PackageIO.Endian.Big)
        Dim Reader3 As New PackageIO.Reader(FilePath, PackageIO.Endian.Big)
        Reader.Position = &HD04B
        TextBox1.Text = Reader.ReadInt32
        Reader2.Position = &HD03F
        TextBox3.Text = Reader2.ReadInt32
        Reader3.Position = &HD03B
        TextBox5.Text = Reader3.ReadInt32
    End Sub

    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        GroupBox1.Enabled = False
        ButtonX1.Enabled = False
        ButtonX2.Enabled = False
    End Sub
End Class
